package com.lb.activity.rest;

import com.lb.activity.mapper.WebArticleMapper;
import com.lb.activity.po.WebArticle;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class TextMqListener {

    @Autowired
    private WebArticleMapper webArticleMapper;

    @RabbitListener(queues = "hello")
    public void process(Long id){
        WebArticle webArticle = webArticleMapper.selectByPrimaryKey(id);
        webArticle.setArtReadCount(webArticle.getArtReadCount()+1);
        webArticleMapper.updateByPrimaryKeySelective(webArticle);
    }
}
